1 start with const int IYou know, when declaring a variable, int I is like this; this I may be re-assigned to it. As follows:Int I = 0;//...I = 20; // The value is assigned again here.However, one day my program may need such a variable (temporarily
In the previous article, the array name is a constant pointer.Reference: http://blog.pfan.cn/whyhappy/5164.htmlConst int * pi, int const * pi and int * const pi and their operations1 start with const int IYou know, when declaring a variable, int I
3.2.2 Constantsand variables can be used in the program to express those that may change the amount of data corresponding to, in C + +, we use constants to express those always remain unchanged data volume. In simple terms, the values, characters,
Pointer to a constant, pointer constant, pointer constant to a constantThe first character is often called a constant pointer. They correspond to the following situations: const int * PI; or Int const * pi; int * const PI; const int * const PI;
3.2.2 Constantsand variables can be used in the program to express those that may change the amount of data corresponding to, in C + +, we use constants to express those always remain unchanged data volume. In simple terms, the values, characters,
I started making homemade beer about 10 years ago, and like many of my own brewers, I started to make purified beer in the kitchen. It took some equipment and it was really good beer, and finally, I used a big storage tank with all the barley in it
ArticleDirectory
Instance 1:
Instance 2:
Instance 3:
Instance 4
For pointers and constants, the following three forms are correct:
Const Char* Myptr = &Char_a; // pointer to a constantChar*ConstMyptr = &Char_a; //
For pointers and constants, the following three forms are correct:
Copy Code code as follows:
const char * myptr = &char_a;//pointer to constant
char * Const MYPTR = pointer to &char_a;//constant
const char * Const MYPTR =
For pointers and constants, the following three forms are correct:
Copy codeThe Code is as follows: const char * myPtr = & char_A; // pointer to a constant
Char * const myPtr = & char_A; // constant pointer
Const char * const myPtr = & char_A; //
ObjectiveA few days ago the woman ticket asked me a Ali's face question, is about the C + + language const constant, in fact, she mentioned that I know the point of inspection: it is certain that the const constant memory is not allocated in the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.